package de.alfenory.autobill.entity;

import java.util.Objects;

/**
 * @author alefen
 */
public class BookEntryTemp extends BookEntry {
    double vatValue;
    String vatType;

    public String getVatType() {
        return vatType;
    }

    public double getVatValue() {
        return vatValue;
    }

    public void setVatType(String vatType) {
        this.vatType = vatType;
    }

    public void setVatValue(double vatValue) {
        this.vatValue = vatValue;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final BookEntryTemp other = (BookEntryTemp) obj;
        if (Double.doubleToLongBits(this.vatValue) != Double.doubleToLongBits(other.vatValue)) {
            return false;
        }
        if (!Objects.equals(this.vatType, other.vatType)) {
            return false;
        }
        
        return super.equals(obj);
    }

    @Override
    public String toString() {
        return "BookEntryTemp{"+super.toString() + "vatValue=" + vatValue + ", vatType=" + vatType + '}';
    }
    
    public BookEntry toBookEntry() {
        BookEntry be = new BookEntry();
        be.setAccount(this.getAccount());
        be.setDescription(this.getDescription());
        be.setTransactionDate(this.getTransactionDate());
        be.setValue(this.getValue());
        be.getDimension().addAll(this.getDimension());
        return be;
    }
    
    
}